package testJavaUtils.threadFactory;

public class ThreadFactoryTest {
	
	public static void main(String[] args) {  
	  CustomThreadFactory factory = new CustomThreadFactory("CustomThreadFactory");  
	  Task task = new Task();  
	  Thread thread;  
	  System.out.printf("Starting the Threads\n\n");  
	  for (int i = 1; i <= 10; i++){  
	     thread = factory.newThread(task);  
	     thread.start();  
	  }  
	  System.out.printf("All Threads are created now\n\n");  
	  System.out.printf("Give me CustomThreadFactory stats:\n\n" + factory.getStats());  
	}
	
	/**
	 * 
	Starting the Threads
	All Threads are created now
	Give me CustomThreadFactory stats:
	Created thread 10 with name CustomThreadFactory-Thread_1 on Wed Nov 22 17:18:40 CST 2017 
	Created thread 11 with name CustomThreadFactory-Thread_2 on Wed Nov 22 17:18:40 CST 2017 
	Created thread 12 with name CustomThreadFactory-Thread_3 on Wed Nov 22 17:18:40 CST 2017 
	Created thread 13 with name CustomThreadFactory-Thread_4 on Wed Nov 22 17:18:40 CST 2017 
	Created thread 14 with name CustomThreadFactory-Thread_5 on Wed Nov 22 17:18:40 CST 2017 
	Created thread 15 with name CustomThreadFactory-Thread_6 on Wed Nov 22 17:18:40 CST 2017 
	Created thread 16 with name CustomThreadFactory-Thread_7 on Wed Nov 22 17:18:40 CST 2017 
	Created thread 17 with name CustomThreadFactory-Thread_8 on Wed Nov 22 17:18:40 CST 2017 
	Created thread 18 with name CustomThreadFactory-Thread_9 on Wed Nov 22 17:18:40 CST 2017 
	Created thread 19 with name CustomThreadFactory-Thread_10 on Wed Nov 22 17:18:40 CST 2017 
 */

}
